<span id="load" url="<?=image_url('load.gif');?>"></span>
<div class="panel">
<div class="row">
	<div class="large-4 columns">
		<div class="btn-group">
			<a href="<?=site_url('teacher/my_classes');?>" class="confirm btn btn-success"title="are you sure you want to exit from grade creator?">Exit</a>
			<a href="<?=site_url('teacher/advisory_input_grades/'.$hash);?>" class="btn">Grades <i class="icon-g-table icon-g-black"></i></a>
			<a href="<?=site_url('teacher/advisory_input_attendance/'.$hash);?>" class="btn btn-primary">Attendance <i class="icon-g-calendar icon-g-white"></i></a>
			<a href="<?=site_url('teacher/advisory_input_remarks/'.$hash);?>" class="btn btn-primary">Remarks <i class="icon-comment icon-white"></i></a>
		</div>
	</div>
	<div class="large-4 columns">
	<?if(isset($section_desc)):?>
		<?if($section_desc):?>
			<?$sec = current($section_desc);?>
			<span style="font-weight:bold;font-size:16px;">Section Name:&nbsp;&nbsp;<?=$sec->section_name;?>,</span>
			<span style="font-weight:bold;font-size:16px;">Grade Level:&nbsp;&nbsp;<?=$sec->level_desc;?></span>
		<?endif;?>
	<?endif;?>
	</div>
	<div class="large-4 columns">
		<label>Go to Section</label>
		<?=form_dropdown('sections',$sections,set_value('sections',$hash),'style="width:200px;display:inline-block;" class="redirect-auto" url="'.$current_url.'"');?>
	</div>
</div>
</div>
<div>
<div>
	<ul class="nav nav-tabs">
	  <li><a href="<?=site_url('teacher/advisory_input_grades/'.$hash);?>" class="current">Bulk Insert</a></li>
	  <li><a href="<?=site_url('teacher/advisory_progress_report/'.$hash);?>">Single Insert</a></li>
	</ul>
</div>
<?if($section_exists):?>
	<table class="table">
		<tbody>
			</thead>
				<tr class="success">
				<?if($gp):?>
						<td>&nbsp;</td>
					<?foreach($gp as $k => $v):?>
						<td><strong><?=ucwords($v->gp_desc);?></strong></td>
					<?endforeach;?>
				<?else:?>
					<td colspan="5">-- Grading Periods --</td>
				<?endif;?>
				</tr>
			</thead>
			<?if($subject):?>
				<?foreach($subject as $subj):?>
					<tr class="info">
						<td colspan="5" style="text-align:center;font-weight:bold;"><?=$subj['subject'];?></td>
					<tr>
					<?if($subj['students']):?>
						<?foreach($subj['students'] as $k => $v):?>
						<tr>
							<td><strong><?=ucwords($v['student_name']);?></strong></td>
							<?if($v['subject']):?>
								<?=form_open();?>
								<?foreach($v['subject'] as $kk => $vv):?>
									<td>
										<span class="loading" style="display:inline-block;"></span>
										<input style="display:inline-block;width:80%;margin:-1px;" type="text" value="<?=$vv->value;?>" url="<?=site_url('output/set_student_grades/'.__link($vv->id));?>" class="ajax-change outline" orgval="<?=$vv->value;?>" name="student[<?=$v['student_e_id'];?>][<?=$vv->id;?>]">
									</td>
								<?endforeach;?>
							<?else:?>
							<td colspan="5">No Grades</td>
							<?endif?>
						</tr>					
						<?endforeach;?>
					<?else:?>
						<td colspan="5">No Students</td>
					<?endif;?>
				<?endforeach;?>
				<tr>
					<td colspan="5">
						<input type="submit" class="btn btn-primary btn-mini" name="input_student_grades" value="Save Grades">
					</td>
				</tr>
			<?else:?>
				<tr>
					<td colspan="5">No Students</td>
				</tr>
			<?endif;?>
		</tbody>
	</table>
</div>
<script src="<?=script_url('custom/grades');?>" type="text/javascript"></script>
<?else:?>
	<div class="alert-box secondary">
		Please Select A Section.
	</div>
<?endif;?>
</div>